import requests
for i in range(250):
    url = f'https://movie.douban.com/top250?start={25*i}&filter'
    headers = {"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0"}
    response = requests.get(url, headers=headers)
    content = response.text
    with open(f'D:/top250.text', 'a', encoding='utf-8') as f:
        f.write(content)
print("爬虫完成")